package Demo1;

public class Test {
    public static void main(String[] args) {
        UseCompute useCompute=new UseCompute();
        Computer[] computer={new Add(),
                             new Minus(),
                             new Ride(),
                             new Divide()};
        for (int i = 0; i <computer.length ; i++) {
            if (computer[i] instanceof Add) {
                useCompute.useCom(computer[i], 10, 5);
            }else if (computer[i] instanceof  Minus){
                useCompute.useCom(computer[i], 10, 5);
            }else if (computer[i] instanceof Ride){
                useCompute.useCom(computer[i], 10, 0);
            }else if (computer[i] instanceof Divide){
                useCompute.useCom(computer[i], 10, 1);
            }
        }

    }
}
